<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="/WEB-INF/tlds/nodes-faces.tld" prefix="n" %>

<f:subview id = "persistedSearchAction">
    <f:subview id="dhidingActions" rendered="#{LayoutBean.hidingActions}" >
        <td width="2%" valign="top" align="left" class="menu-container">
            <h:inputHidden value="#{PathBean.path}"/>

            <h:commandLink actionListener="#{LayoutBean.showActions}">
                <h:graphicImage value="#{NodesBean.imagePath}/end.png" alt="#{msg.versions}" title="#{msg.versions}"/>
            </h:commandLink>

            &nbsp;

            <%-- Move --%>
            <h:panelGroup id="move" layout="block" style="display:inline" rendered="#{NodesBean.appletSubstitution}"/>
            <n:applet elementId="move"
                      code="offset.nodes.client.dialog.chooser.view.MoveNodeApplet" codebase="#{NodesBean.contextPath}" jar="dialog.jar"
                      width="0" height="0" rendered="#{NodesBean.appletSubstitution}">
                <f:param name="service" value="#{NodesBean.dialogPath}"/>
                <f:param name="path" value="#{DataBean.path}"/>
                <f:param name="root" value="/"/>
                <f:param name="filter" value="*"/>
                <f:param name="onlyFolders" value="true"/>
                <f:param name="repository" value="#{NodesBean.repositoryPath}"/>
            </n:applet>

            <n:applet rendered="#{!NodesBean.appletSubstitution && DataBean.components.move.rendered}"
                      code="offset.nodes.client.dialog.chooser.view.MoveNodeApplet" codebase="#{NodesBean.contextPath}" jar="dialog.jar"
                      width="0" height="0">
                <f:param name="service" value="#{NodesBean.dialogPath}"/>
                <f:param name="path" value="#{DataBean.path}"/>
                <f:param name="root" value="/"/>
                <f:param name="filter" value="*"/>
                <f:param name="onlyFolders" value="true"/>
                <f:param name="repository" value="#{NodesBean.repositoryPath}"/>
            </n:applet>

            <%-- Edit --%>
            <h:panelGroup id="edit" layout="block" style="display:inline" rendered="#{NodesBean.appletSubstitution}"/>
            <n:applet elementId="edit"
                      code="offset.nodes.client.dialog.xpath.view.EditXPathQueryApplet" codebase="#{NodesBean.contextPath}" jar="dialog.jar"
                      width="0" height="0" rendered="#{NodesBean.appletSubstitution}">
                <f:param name="service" value="#{NodesBean.dialogPath}"/>
                <f:param name="base" value="#{NodesBean.repositoryPath}"/>
                <f:param name="path" value="#{PathBean.path}"/>
            </n:applet>

            <n:applet rendered="#{!NodesBean.appletSubstitution && SearchBean.components.edit.rendered}"
                      code="offset.nodes.client.dialog.xpath.view.EditXPathQueryApplet" codebase="#{NodesBean.contextPath}" jar="dialog.jar"
                      width="0" height="0">
                <f:param name="service" value="#{NodesBean.dialogPath}"/>
                <f:param name="base" value="#{NodesBean.repositoryPath}"/>
                <f:param name="path" value="#{PathBean.path}"/>
            </n:applet>

            <h:panelGrid columns="1" styleClass="menu">

                <%-- Edit --%>
                <h:outputLink onclick="edit()" styleClass="submit" value="#" rendered="#{NodesBean.appletSubstitution}">
                    <h:outputText value="#{msg.dataActionsMove}"/>
                </h:outputLink>
                <h:commandLink value="#{msg.dataActionsEdit}" actionListener="#{SearchBean.renderEdit}" styleClass="submit" rendered="#{!NodesBean.appletSubstitution}"/>

                <h:outputLink onclick="move()" styleClass="submit" value="#" rendered="#{NodesBean.appletSubstitution}">
                    <h:outputText value="#{msg.dataActionsMove}"/>
                </h:outputLink>
                <h:commandLink value="#{msg.dataActionsMove}" actionListener="#{DataBean.renderMove}" styleClass="submit" rendered="#{!NodesBean.appletSubstitution}"/>

                <h:commandLink value="#{msg.dataActionsRemove}" actionListener="#{DataBean.remove}" styleClass="submit"/>

            </h:panelGrid>


        </td>
    </f:subview>

    <f:subview id="searchActions" rendered="#{LayoutBean.showingActions}" >
        <td align="left" valign="top" class="action" height="418">
            <f:loadBundle basename="offset.nodes.server.view.ApplicationResource" var="msg"/>

            <h:inputHidden value="#{PathBean.path}"/>
            <h:panelGrid columns="1">
                <h:panelGroup>
                    <h:panelGrid columns="1" columnClasses="right">
                        <h:commandLink actionListener="#{LayoutBean.hideActions}">
                            <h:graphicImage value="#{NodesBean.imagePath}/start.png" alt="#{msg.versions}" title="#{msg.versions}" />
                        </h:commandLink>
                    </h:panelGrid>
                </h:panelGroup>

                <h:panelGroup>
                    <h:commandLink value="#{msg.dataActionsEdit}" actionListener="#{SearchBean.renderEdit}" styleClass="submit"/>
                    <n:applet rendered="#{SearchBean.components.edit.rendered}"
                              code="offset.nodes.client.dialog.xpath.view.EditXPathQueryApplet" codebase="#{NodesBean.contextPath}" jar="dialog.jar"
                              width="0" height="0">
                        <f:param name="service" value="#{NodesBean.dialogPath}"/>
                        <f:param name="base" value="#{NodesBean.repositoryPath}"/>
                        <f:param name="path" value="#{PathBean.path}"/>
                    </n:applet>
                </h:panelGroup>

                <h:panelGroup>
                    <h:commandLink value="#{msg.dataActionsMove}" actionListener="#{DataBean.renderMove}" styleClass="submit"/>
                    <n:applet rendered="#{DataBean.components.move.rendered}"
                              code="offset.nodes.client.dialog.chooser.view.MoveNodeApplet" codebase="#{NodesBean.contextPath}" jar="dialog.jar"
                              width="0" height="0">
                        <f:param name="service" value="#{NodesBean.dialogPath}"/>
                        <f:param name="path" value="#{DataBean.path}"/>
                        <f:param name="root" value="/"/>
                        <f:param name="filter" value="*"/>
                        <f:param name="onlyFolders" value="true"/>
                        <f:param name="repository" value="#{NodesBean.repositoryPath}"/>
                    </n:applet>
                </h:panelGroup>

                <h:panelGroup>
                    <h:commandLink value="#{msg.dataActionsRemove}" actionListener="#{DataBean.remove}" styleClass="submit"/>
                </h:panelGroup>

            </h:panelGrid>
        </td>
    </f:subview>
</f:subview>